<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateTableItems extends Migration {
	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up() {
		Schema::create('items', function (Blueprint $table) {
			$table->increments('id');
			$table->string('title', 50)->comment('标题')->index();
			$table->integer('user_id')->comment('创建者id');
			$table->integer('cate_id')->comment('分类id')->index();
			$table->string('briefly')->nullable()->comment('描述');
			$table->string('image')->nullable()->comment('图片');
			$table->text('content')->comment('主体');
			$table->integer('see_nums')->default(0)->comment('查看数');
			$table->integer('approve_nums')->default(0)->comment('点赞数');
			$table->integer('comment_nums')->default(0)->comment('评论数');
			$table->boolean('top')->default(false)->comment('置顶');
			$table->boolean('allow_comment')->default(true)->comment('允许评论');
			$table->boolean('type')->default(true)->comment('makedown|富文本');
			$table->boolean('status')->default(true)->comment('状态')->index();
			$table->timestamps();
			$table->softDeletes();
		});
	}

	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down() {
		Schema::dropIfExists('items');
	}
}
